<template>
  <el-container class="home-container">
    <el-header>
      <router-link style="text-decoration: none;" to="/home">
        <div class="logo_tile">
          <h2>数据资源包</h2>
        </div>
      </router-link>
      <div class="logo_tile">
        <span> 欢迎：<i class="el-icon-arrow-left"></i>{{loginname}}<i class="el-icon-arrow-right"></i> </span>
        <el-button @click="logout" type="info">退出</el-button>
      </div>
    </el-header>
    <el-container>
      <el-aside :width="isCollapse ? '65px' : '200px'">
        <div class="toggleBar" @click="isCollapse=!isCollapse">|||</div>
        <el-menu
          class="el-menu-vertical-demo"
          background-color="#ccccff"
          text-color="#fff"
          router
          unique-opened
          :collapse="isCollapse"
          :collapse-transition="false"
          active-text-color="#409EFF">

          <el-submenu  index="1-4" :class="{'el_submenu_large':!isCollapse,'el_submenu_small':isCollapse}">
            <template slot="title">
              <i class="el-icon-s-tools"></i>
              <span slot="title">系统中心</span>
            </template>
            <el-menu-item index="resourcelist"  v-if="user.status=='1'?!isShow:isShow"><i class="el-icon-eleme"></i>数据资产包</el-menu-item>
            <el-menu-item index="resourcelistTui"  v-if="user.status=='2'?!isShow:isShow"><i class="el-icon-delete-solid"></i>数据资产包</el-menu-item>
            <el-menu-item index="addResourceForm" v-if="user.status=='2'?!isShow:isShow"><i class="el-icon-s-custom"></i>添加数据包</el-menu-item>
            <el-menu-item index="resourceListFa" ><i class="el-icon-s-custom"></i>公共数据包</el-menu-item>
            <el-menu-item index="addresource" v-if="user.status=='1'?!isShow:isShow"><i class="el-icon-s-custom"></i>添加数据包</el-menu-item>


            <!--            <el-menu-item index="1-4-3" ><i class="el-icon-menu"></i>菜单管理</el-menu-item>-->
<!--            <el-menu-item index="1-4-4" ><i class="el-icon-s-check"></i>权限管理</el-menu-item>-->
          </el-submenu>

        </el-menu>
      </el-aside>
      <!-- 右侧的 主体区域 -->
      <el-main>
          <router-view></router-view>
      </el-main>
    </el-container>
    <span style="color: gray; position: fixed; bottom: 0; right: 0;">数据资源包</span>
  </el-container>
</template>

<script>
  export default {
    name: "Home",
    data() {
      return {
        isShow:'',
        isCollapse:false,
        loginname:'',
        user:{},
      }
    },
    methods:{
      logout:function () {
         sessionStorage.removeItem("user");
         this.$router.push("/login")
      }
    },
    mounted () {
      this.user  = JSON.parse(sessionStorage.getItem("user"));
      this.loginname = this.user.username;
    }
  }
</script>

<style lang="less" scoped>
  .home-container {
    height: 100%;
  }

  .el-header {
    background-color: #ccccff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    user-select: none;

    .logo_tile {
      display: flex;
      align-items: center;
      color: white;

      h2 {
        font-weight: 200;
        margin-left: 15px;
      }
    }

    .el-button {
      margin-right: 10px;
    }
  }

  .el-aside {
    background-color: #ccccff;
    user-select: none;
  }

  .el-main {
    background-color: #eaedf1;
  }

  .iconfont {
    margin-right: 8px;
  }

  .toggleBar {
    color: #fff;
    font-size: 12px;
    line-height: 24px;
    background-color: #ccccff;
    text-align: center;
    letter-spacing: 0.2em;
    cursor: pointer;
    user-select: none;
  }

  .el_submenu_large {
    width: 200px;
  }

  .el_submenu_small {
    width: 65px;
  }
</style>
